package com.lhl.jwt.service;

import io.swagger.annotations.Api;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

/**
 * @className: com.lhl.jwt.service.JwtUserDetailsService
 * @description: 实现 loadUserByUsername 方法
 * 根据项目需求是否需要产生随机salt 保存至数据库或缓存中
 * @author: king
 * @date: 2020-12-21 13:38
 **/
@Api(tags = "JwtUserDetailsService", produces = "JwtUserDetailsService")
public interface JwtUserDetailsService extends UserDetailsService {
//    default void insertSalt(String salt, UserDetails user) {
//        // null implements
//    }
//    default void removeSalt(String username) {
//        // null implements
//    }

    /**
     * BCrypt.gensalt()
     * 正式开放可使用该方法生成随机盐
     * @param username
     * @return
     */
//    default String getSalt(String username) {
//        // always return null
//        return null;
//    }
    /**
     * @param: mobile
     * @description: 手机登入
     * @return: org.springframework.security.core.userdetails.UserDetails
     * @author: king
     * @date: 2020-12-23 11:30
     */
    default UserDetails loadUserByMobile(String mobile) throws UsernameNotFoundException{
        return null;
    }

    /**
     * @param: openId
     * @description: 公众号,小程序
     * @return: org.springframework.security.core.userdetails.UserDetails
     * @author: king
     * @date: 2020-12-23 11:31
     */
    default UserDetails loadUserByOpenId(String openId) throws UsernameNotFoundException{
        return null;
    }
    /**
     * @param: userId
     * @description: 企业微信
     * @return: org.springframework.security.core.userdetails.UserDetails
     * @author: king
     * @date: 2020-12-30 10:43
     */
    default UserDetails loadUserByUserId(String userId) throws UsernameNotFoundException{
        return null;
    }
    @Override
    default UserDetails loadUserByUsername(String username) throws UsernameNotFoundException{
        return null;
    }

}
